﻿@model XPressify.Models.MediaUploadModel

<div>
    <script type="text/javascript">
        $(document).ready(function () {
            var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
            var aId = "@(Model.Id)";
            var uId = "@(Model.UserId)";

            $('#fileInput').uploadify({
                uploader: '../../Content/flash/uploadify.swf',
                script: '/@Model.ControllerName/@Model.ActionName',
                folder: '/Media',
                cancelImg: '../../Content/images/cancel.png',
                auto: false,
                multi: true,
                removeCompleted: false,
                queueID: 'custom-queue',
                scriptData: { albumId: aId, userId: uId, token: auth },
                fileDesc: 'Any document type',
                fileExt: '@Model.FileExtension',

                sizeLimit: 5000000,
                scriptAccess: 'always', //testing locally. comment before deploy
                buttonText: 'Browse...'
            });

            $("#btnSave").button().click(function (event) {
                event.preventDefault();
                $('#fileInput').uploadifyUpload();
            });

        });
        </script>
        <div>
            <div id="status-message"></div>
            <div id="custom-queue" class="uploadifyQueue"></div>
        </div>
        <div>
            <input id="fileInput" name="fileInput" type="file" />
        </div>
</div>